﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using RoundupReadyPlusWPF.AppCode;

namespace RoundupReadyPlusWPF.Controls
{
    /// <summary>
    /// Interaction logic for StepBanner.xaml
    /// </summary>
    public partial class StepBanner : UserControl, IObserver<PageSwitcher>
    {
        public StepBanner()
        {
            InitializeComponent();
        }

        public String Step
        { 
            get{
                return lblNumber.Content.ToString();
            }
            set{
                String valor = value;

                if (!String.IsNullOrEmpty(valor))
                {
                    lblNumber.FontSize = valor.Length <= 2 ? 130 : 80;
                }


                lblNumber.Content = value;
            } 
        }


        public void OnCompleted()
        {
            // caso pare de observar mudança de página
        }

        public void OnError(Exception error)
        {
            // fica sem atualizar por algum erro no swtich da pagina
        }

        public void OnNext(PageSwitcher value)
        {
            switch (value.CurrentPage)
            {
                case PageSwitcher.Pages.Region:
                    Step = "01";
                    break;

                case PageSwitcher.Pages.State:
                    Step = "02";
                    break;

                case PageSwitcher.Pages.District:
                    Step = "03";
                    break;

                case PageSwitcher.Pages.Town:
                    Step = "04";
                    break;

                case PageSwitcher.Pages.Filters:
                    Step = "SUL";
                    break;

                case PageSwitcher.Pages.Table:
                    break;

                case PageSwitcher.Pages.Map:
                    break;

                default:
                    Step = "00";
                    break;
            }
        }
    }
}
